﻿//===================================================================================
// Copyright (c) Ryan Garrett.  All rights reserved.
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY
// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT
// LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
// FITNESS FOR A PARTICULAR PURPOSE.
//===================================================================================
using System;
using System.Collections.Generic;

namespace Caffeine.Core.Test.TestModel
{
    public class ModelForFieldTesting : ModelBase
    {
        #region FirstName Property

        [ModelBackingProperty(typeof(String), "FirstNameProperty", ModelBase.StandardBehaviors, false)]
        protected readonly ModelProperty<String> _FirstNameProperty = null; //Will be set by reflection.

        /// <summary>
        /// Gets the FirstName backing property
        /// </summary>
        public ModelProperty<String> FirstNameProperty
        {
            get { return _FirstNameProperty; }
        }

        /// <summary>
        /// Gets or sets the FirstNameProperty.Value value. This property supports change notification. If the FirstNameProperty.Value value changes,
        /// it will cause a change notification event for this property. This property must follow the [FirstNameProperty - "Property"] convention for change events to work correctly.
        /// </summary>
        public String FirstName
        {
            get { return FirstNameProperty.Value; }
            set { FirstNameProperty.Value = value; }
        }

        /// <summary>
        /// Gets the FirstNameProperty.CommittedValue value. This property supports change notification. If the FirstNameProperty.CommittedValue value changes,
        /// it will cause a change notification event for this property. This property must follow the [FirstName + "CommittedValue"] convention for change events to work correctly.
        /// </summary>
        public String FirstNameCommittedValue
        {
            get { return FirstNameProperty.CommittedValue; }
        }

        /// <summary>
        /// Gets the FirstNameProperty.IsDirty flag. This property supports change notification. If the FirstNameProperty.IsDirty flag changes,
        /// it will cause a change notification event for this property. This property must follow the [FirstName + "IsDirty"] convention for change events to work correctly.
        /// </summary>
        public Boolean FirstNameIsDirty
        {
            get { return FirstNameProperty.IsDirty; }
        }

        /// <summary>
        /// Gets the FirstNameProperty.IsInvalid flag. This property supports change notification. If the FirstNameProperty.IsInvalid flag changes,
        /// it will cause a change notification event for this property. This property must follow the [FirstName + "IsInvalid"] convention for change events to work correctly.
        /// </summary>
        public Boolean FirstNameIsInvalid
        {
            get { return FirstNameProperty.IsInvalid; }
        }

        /// <summary>
        /// Gets the FirstNameProperty.IsDefault flag. This property supports change notification. If the FirstNameProperty.IsDefault flag changes,
        /// it will cause a change notification event for this property. This property must follow the [FirstName + "IsDefault"] convention for change events to work correctly.
        /// </summary>
        public Boolean FirstNameIsDefault
        {
            get { return FirstNameProperty.IsDefault; }
        }

        /// <summary>
        /// Gets the FirstNameProperty.ValidationErrors enumeration. This property supports change notification. If the FirstNameProperty.ValidationErrors enumeration changes,
        /// it will cause a change notification event for this property. This property must follow the [FirstName + "ValidationErrors"] convention for change events to work correctly.
        /// </summary>
        public IEnumerable<ValidationError> FirstNameValidationErrors
        {
            get { return FirstNameProperty.ValidationErrors; }
        }

        #endregion

        #region LastName Property

        [ModelBackingProperty(typeof(String), "LastNameProperty", ModelBase.StandardBehaviors, false)]
        protected readonly ModelProperty<String> _LastNameProperty = null; //Will be set by reflection.

        /// <summary>
        /// Gets the LastName backing property
        /// </summary>
        public ModelProperty<String> LastNameProperty
        {
            get { return _LastNameProperty; }
        }

        /// <summary>
        /// Gets or sets the LastNameProperty.Value value. This property supports change notification. If the LastNameProperty.Value value changes,
        /// it will cause a change notification event for this property. This property must follow the [LastNameProperty - "Property"] convention for change events to work correctly.
        /// </summary>
        public String LastName
        {
            get { return LastNameProperty.Value; }
            set { LastNameProperty.Value = value; }
        }

        /// <summary>
        /// Gets the LastNameProperty.CommittedValue value. This property supports change notification. If the LastNameProperty.CommittedValue value changes,
        /// it will cause a change notification event for this property. This property must follow the [LastName + "CommittedValue"] convention for change events to work correctly.
        /// </summary>
        public String LastNameCommittedValue
        {
            get { return LastNameProperty.CommittedValue; }
        }

        /// <summary>
        /// Gets the LastNameProperty.IsDirty flag. This property supports change notification. If the LastNameProperty.IsDirty flag changes,
        /// it will cause a change notification event for this property. This property must follow the [LastName + "IsDirty"] convention for change events to work correctly.
        /// </summary>
        public Boolean LastNameIsDirty
        {
            get { return LastNameProperty.IsDirty; }
        }

        /// <summary>
        /// Gets the LastNameProperty.IsInvalid flag. This property supports change notification. If the LastNameProperty.IsInvalid flag changes,
        /// it will cause a change notification event for this property. This property must follow the [LastName + "IsInvalid"] convention for change events to work correctly.
        /// </summary>
        public Boolean LastNameIsInvalid
        {
            get { return LastNameProperty.IsInvalid; }
        }

        /// <summary>
        /// Gets the LastNameProperty.IsDefault flag. This property supports change notification. If the LastNameProperty.IsDefault flag changes,
        /// it will cause a change notification event for this property. This property must follow the [LastName + "IsDefault"] convention for change events to work correctly.
        /// </summary>
        public Boolean LastNameIsDefault
        {
            get { return LastNameProperty.IsDefault; }
        }

        /// <summary>
        /// Gets the LastNameProperty.ValidationErrors enumeration. This property supports change notification. If the LastNameProperty.ValidationErrors enumeration changes,
        /// it will cause a change notification event for this property. This property must follow the [LastName + "ValidationErrors"] convention for change events to work correctly.
        /// </summary>
        public IEnumerable<ValidationError> LastNameValidationErrors
        {
            get { return LastNameProperty.ValidationErrors; }
        }

        #endregion

        #region Age Property

        [ModelBackingProperty(typeof(Nullable<Int32>), "AgeProperty", ModelBase.StandardBehaviors, false)]
        protected readonly ModelProperty<Nullable<Int32>> _AgeProperty = null; //Will be set by reflection.

        /// <summary>
        /// Gets the Age backing property
        /// </summary>
        public ModelProperty<Nullable<Int32>> AgeProperty
        {
            get { return _AgeProperty; }
        }

        /// <summary>
        /// Gets or sets the AgeProperty.Value value. This property supports change notification. If the AgeProperty.Value value changes,
        /// it will cause a change notification event for this property. This property must follow the [AgeProperty - "Property"] convention for change events to work correctly.
        /// </summary>
        public Nullable<Int32> Age
        {
            get { return AgeProperty.Value; }
            set { AgeProperty.Value = value; }
        }

        /// <summary>
        /// Gets the AgeProperty.CommittedValue value. This property supports change notification. If the AgeProperty.CommittedValue value changes,
        /// it will cause a change notification event for this property. This property must follow the [Age + "CommittedValue"] convention for change events to work correctly.
        /// </summary>
        public Nullable<Int32> AgeCommittedValue
        {
            get { return AgeProperty.CommittedValue; }
        }

        /// <summary>
        /// Gets the AgeProperty.IsDirty flag. This property supports change notification. If the AgeProperty.IsDirty flag changes,
        /// it will cause a change notification event for this property. This property must follow the [Age + "IsDirty"] convention for change events to work correctly.
        /// </summary>
        public Boolean AgeIsDirty
        {
            get { return AgeProperty.IsDirty; }
        }

        /// <summary>
        /// Gets the AgeProperty.IsInvalid flag. This property supports change notification. If the AgeProperty.IsInvalid flag changes,
        /// it will cause a change notification event for this property. This property must follow the [Age + "IsInvalid"] convention for change events to work correctly.
        /// </summary>
        public Boolean AgeIsInvalid
        {
            get { return AgeProperty.IsInvalid; }
        }

        /// <summary>
        /// Gets the AgeProperty.IsDefault flag. This property supports change notification. If the AgeProperty.IsDefault flag changes,
        /// it will cause a change notification event for this property. This property must follow the [Age + "IsDefault"] convention for change events to work correctly.
        /// </summary>
        public Boolean AgeIsDefault
        {
            get { return AgeProperty.IsDefault; }
        }

        /// <summary>
        /// Gets the AgeProperty.ValidationErrors enumeration. This property supports change notification. If the AgeProperty.ValidationErrors enumeration changes,
        /// it will cause a change notification event for this property. This property must follow the [Age + "ValidationErrors"] convention for change events to work correctly.
        /// </summary>
        public IEnumerable<ValidationError> AgeValidationErrors
        {
            get { return AgeProperty.ValidationErrors; }
        }

        #endregion

        #region DateOfBirth Property

        [ModelBackingProperty(typeof(Nullable<DateTime>), "DateOfBirthProperty", ModelBase.StandardBehaviors, false)]
        protected readonly ModelProperty<Nullable<DateTime>> _DateOfBirthProperty = null; //Will be set by reflection.

        /// <summary>
        /// Gets the DateOfBirth backing property
        /// </summary>
        public ModelProperty<Nullable<DateTime>> DateOfBirthProperty
        {
            get { return _DateOfBirthProperty; }
        }

        /// <summary>
        /// Gets or sets the DateOfBirthProperty.Value value. This property supports change notification. If the DateOfBirthProperty.Value value changes,
        /// it will cause a change notification event for this property. This property must follow the [DateOfBirthProperty - "Property"] convention for change events to work correctly.
        /// </summary>
        public Nullable<DateTime> DateOfBirth
        {
            get { return DateOfBirthProperty.Value; }
            set { DateOfBirthProperty.Value = value; }
        }

        /// <summary>
        /// Gets the DateOfBirthProperty.CommittedValue value. This property supports change notification. If the DateOfBirthProperty.CommittedValue value changes,
        /// it will cause a change notification event for this property. This property must follow the [DateOfBirth + "CommittedValue"] convention for change events to work correctly.
        /// </summary>
        public Nullable<DateTime> DateOfBirthCommittedValue
        {
            get { return DateOfBirthProperty.CommittedValue; }
        }

        /// <summary>
        /// Gets the DateOfBirthProperty.IsDirty flag. This property supports change notification. If the DateOfBirthProperty.IsDirty flag changes,
        /// it will cause a change notification event for this property. This property must follow the [DateOfBirth + "IsDirty"] convention for change events to work correctly.
        /// </summary>
        public Boolean DateOfBirthIsDirty
        {
            get { return DateOfBirthProperty.IsDirty; }
        }

        /// <summary>
        /// Gets the DateOfBirthProperty.IsInvalid flag. This property supports change notification. If the DateOfBirthProperty.IsInvalid flag changes,
        /// it will cause a change notification event for this property. This property must follow the [DateOfBirth + "IsInvalid"] convention for change events to work correctly.
        /// </summary>
        public Boolean DateOfBirthIsInvalid
        {
            get { return DateOfBirthProperty.IsInvalid; }
        }

        /// <summary>
        /// Gets the DateOfBirthProperty.IsDefault flag. This property supports change notification. If the DateOfBirthProperty.IsDefault flag changes,
        /// it will cause a change notification event for this property. This property must follow the [DateOfBirth + "IsDefault"] convention for change events to work correctly.
        /// </summary>
        public Boolean DateOfBirthIsDefault
        {
            get { return DateOfBirthProperty.IsDefault; }
        }

        /// <summary>
        /// Gets the DateOfBirthProperty.ValidationErrors enumeration. This property supports change notification. If the DateOfBirthProperty.ValidationErrors enumeration changes,
        /// it will cause a change notification event for this property. This property must follow the [DateOfBirth + "ValidationErrors"] convention for change events to work correctly.
        /// </summary>
        public IEnumerable<ValidationError> DateOfBirthValidationErrors
        {
            get { return DateOfBirthProperty.ValidationErrors; }
        }

        #endregion

        #region Child Property

        [ModelBackingProperty(typeof(ModelForFieldTesting), "ChildProperty", ModelBase.StandardBehaviors, false)]
        protected readonly ModelProperty<ModelForFieldTesting> _ChildProperty = null; //Will be set by reflection.

        /// <summary>
        /// Gets the Child backing property
        /// </summary>
        public ModelProperty<ModelForFieldTesting> ChildProperty
        {
            get { return _ChildProperty; }
        }

        /// <summary>
        /// Gets or sets the ChildProperty.Value value. This property supports change notification. If the ChildProperty.Value value changes,
        /// it will cause a change notification event for this property. This property must follow the [ChildProperty - "Property"] convention for change events to work correctly.
        /// </summary>
        public ModelForFieldTesting Child
        {
            get { return ChildProperty.Value; }
            set { ChildProperty.Value = value; }
        }

        /// <summary>
        /// Gets the ChildProperty.CommittedValue value. This property supports change notification. If the ChildProperty.CommittedValue value changes,
        /// it will cause a change notification event for this property. This property must follow the [Child + "CommittedValue"] convention for change events to work correctly.
        /// </summary>
        public ModelForFieldTesting ChildCommittedValue
        {
            get { return ChildProperty.CommittedValue; }
        }

        /// <summary>
        /// Gets the ChildProperty.IsDirty flag. This property supports change notification. If the ChildProperty.IsDirty flag changes,
        /// it will cause a change notification event for this property. This property must follow the [Child + "IsDirty"] convention for change events to work correctly.
        /// </summary>
        public Boolean ChildIsDirty
        {
            get { return ChildProperty.IsDirty; }
        }

        /// <summary>
        /// Gets the ChildProperty.IsInvalid flag. This property supports change notification. If the ChildProperty.IsInvalid flag changes,
        /// it will cause a change notification event for this property. This property must follow the [Child + "IsInvalid"] convention for change events to work correctly.
        /// </summary>
        public Boolean ChildIsInvalid
        {
            get { return ChildProperty.IsInvalid; }
        }

        /// <summary>
        /// Gets the ChildProperty.IsDefault flag. This property supports change notification. If the ChildProperty.IsDefault flag changes,
        /// it will cause a change notification event for this property. This property must follow the [Child + "IsDefault"] convention for change events to work correctly.
        /// </summary>
        public Boolean ChildIsDefault
        {
            get { return ChildProperty.IsDefault; }
        }

        /// <summary>
        /// Gets the ChildProperty.ValidationErrors enumeration. This property supports change notification. If the ChildProperty.ValidationErrors enumeration changes,
        /// it will cause a change notification event for this property. This property must follow the [Child + "ValidationErrors"] convention for change events to work correctly.
        /// </summary>
        public IEnumerable<ValidationError> ChildValidationErrors
        {
            get { return ChildProperty.ValidationErrors; }
        }

        #endregion
    }
}
